B Binance · The world's largest crypto exchangeBinance Sign up → AD OKX OKX · A leading global crypto exchangeOKX Sign up → AD
📈 Stock analysis tools

🧪 Stock Strategy Backtester

Pick a stock and backtest MA cross, RSI, MACD and 3 more rules on real Korean, US and Japanese prices (Yahoo Finance), dividends and tax included. Not advice.

Loading Data: Yahoo Finance (via our server, may be delayed)
–

Strategy and costs

Decided on the bar close, filled at the next open

–

Backtest result

Total return–
CAGR–
Max drawdown (MDD)–
Win rate–
Profit factor–
Trades–
Average trade–
Exposure–
Final equity–
–

Price and trades

Closed bars only · ▲ buy ▼ sell (P/L)

Where the rule stands now

–

Trade and risk statistics

Average winner–
Average loser–
Payoff ratio (avg win ÷ avg loss)–
Best trade–
Worst trade–
Longest losing streak–
Average holding time–
Return with zero costs–
Return lost to costs–
Return without dividends (price only)–
Added by reinvested dividends–
Annual volatility (strategy / hold)–
Sharpe ratio (strategy / hold, risk-free 0)–

Equity curve

Drawdown (% below the running peak)

Year-by-year returns

Year Strategy Buy & hold Difference Trades closed
–

Each year compares the equity on its last closed bar with the previous year’s last value (dividends reinvested). The first and last years may be partial.

Trade list

# Entry Entry price Exit Exit price Return Held
–

Click a number to move the price chart to that trade. Fill prices are actual (unadjusted) prices plus slippage; returns are after fees and tax on both sides and include dividends received while holding, reinvested.

Nearby-parameter check (overfitting test)

–

Total return of the same test re-run with nearby parameter values. If only the centre cell looks good and its neighbours do not, the setting probably fits the past by chance. Click a cell to switch to it.

Same strategy on other stocks

Stock
Pick a group and press the button to apply the current strategy, parameters and period to every stock in it.

Click a stock to open its full result above. The lists hold today’s large caps, so companies that shrank or disappeared are missing (survivorship bias).

Reading a backtest honestly

For information only, not investment advice. Prices come from Yahoo Finance via our server and may be delayed 15–20 minutes or more depending on the exchange, or interrupted. Charts: TradingView Lightweight Charts™

What this tool does

What if you had traded this rule in the past? The stock strategy backtester runs six trading rules — moving-average crossover (golden cross), RSI reversal, Bollinger Band reversal, MACD crossover, Supertrend and Donchian breakout — on real price history for Korean large caps such as Samsung Electronics and SK hynix, US stocks such as Apple and Nvidia, Japanese stocks, and Korean and US ETFs and indices. It compares total return, CAGR, maximum drawdown (MDD), win rate, profit factor and Sharpe ratio side by side with simply holding over the same period. Returns use the dividend-adjusted close, Korean shares are charged securities transaction tax on sales, and signals come from closed bars only, so no future data is used.

How it is calculated

Prices come from Yahoo Finance through this site’s server, as bars shared by all visitors; only closed bars are used. Daily bars test the last 1, 2, 3, 5, 10 or 20 years or all available data, weekly bars the last 2, 3, 5, 10 or 20 years or all data, and monthly bars the last 10 or 20 years or all data. The bars before the test (for all data: 300 daily, 150 weekly, 60 monthly) only warm up the indicators; no trades happen there, and the page says so when a recent listing leaves too few of them. Signals are decided on the close of bar i — the actual price shown on the chart, adjusted only for splits — and filled at the open of bar i+1. Buy fill = open × (1 + slippage), sell fill = open × (1 − slippage); the buy fee is charged on purchases, and the sell fee plus tax on sales. Returns are measured on the adjusted close (dividends and splits): each bar’s open, high, low and close are multiplied by adjusted close ÷ close, which is the same as reinvesting each dividend in full, before tax, on its pay date. Indices are price indices, so they include no dividends. Default costs depend on the market. Korean stocks: 0.015% fee on each buy and sell and 0.20% tax on sales — the 2026 rate, KOSPI 0.05% securities transaction tax plus 0.15% special rural tax, KOSDAQ 0.20%. Korean ETFs and Korean indices: 0.015% fee each way and no tax (Korean ETFs are exempt from transaction tax on sale). Overseas symbols: zero commission assumed. Slippage is 0.05% for all, and starting capital is KRW 10 million, USD 10,000 or JPY 1 million. Each trade uses all available capital (fractional shares allowed), long only. “Crosses above” means A ≤ B on the previous bar and A > B on this bar. ① MA cross: buy when the fast line (default EMA 20) crosses above the slow line (EMA 60), sell when it crosses below. ② RSI reversal: buy when RSI (14, Wilder smoothing) crosses back above 30, sell when it crosses back below 70. ③ Bollinger reversal: bands = 20-bar SMA ± 2 × population standard deviation; buy when the close crosses back above the lower band, sell when the close ≥ the middle band (or the upper band if chosen); if both happen on one bar, the sell wins. ④ MACD cross: buy when MACD (EMA 12 − EMA 26) crosses above its signal line (EMA 9 of MACD), optionally only while MACD < 0; sell when it crosses below. ⑤ Supertrend (ATR 10, factor 3): buy on the bar where the direction flips from down to up, sell where it flips from up to down. ⑥ Donchian breakout: buy when the close > the highest high of the previous 20 bars, sell when the close < the lowest low of the previous 10 bars. Total return = final equity ÷ starting capital − 1 (an open position is marked at the last close); CAGR = (final ÷ start)^(1 ÷ years) − 1 (hidden under 3 months); MDD = the largest fall of equity from its running peak; win rate = winning trades ÷ closed trades; profit factor = sum of winning trade returns ÷ sum of losing trade losses; exposure = bars in a position ÷ all bars; annual volatility = standard deviation of bar-to-bar equity changes × √(bars per year); Sharpe ratio = mean bar return × bars per year ÷ annual volatility (risk-free rate assumed 0), where bars per year = test bars ÷ years. Buy and hold buys at the first test bar’s open with the same buy cost and slippage and holds to the last close. Year-by-year returns compare each year’s last equity with the previous year’s. While the market is open the page reloads every 5 minutes, otherwise every hour, and recalculates only when the last closed bar changes. KRW amounts for dollar or yen stocks multiply by today’s exchange rate and are for reference only.

Reading the screen, section by section

Symbol, bar size and period

Type a name or code such as Nvidia, Apple, Samsung Electronics or SK hynix into the search box, or use the shortcut buttons just below (Samsung Electronics, SK hynix, a KOSPI 200 ETF, the KOSPI, an S&P 500 ETF, a Nasdaq 100 ETF, Nvidia, Apple, Toyota). Bars can be daily, weekly or monthly. Daily bars test the last 1, 2, 3, 5, 10 or 20 years or all data; weekly bars 2, 3, 5, 10 or 20 years or all data; monthly bars 10 or 20 years or all data. Beside them you see the actual test range and bar count (and, for a recent listing, when testing starts), and the line below shows the exchange, currency, security type, whether the market is open and the quote time in the exchange's city time. Further notes appear when an early stretch was cut because of bad data, when no adjusted close is available so only prices are used, or when an index cannot be bought directly, with a similar ETF suggested.

Strategy and costs — rules, parameters, fees

Pick one of the six strategies and only its parameter fields appear. Edits are recalculated after a short pause; an out-of-range value leaves the previous result greyed out with an error message. Cost fields fill in automatically for the symbol's market: Korean stocks pay 0.015% commission each way plus 0.20% tax on sales, Korean ETFs and indices pay no tax, and overseas stocks such as US shares assume zero commission. Slippage is 0.05% everywhere, and starting capital is 10 million won, 10,000 dollars or 1 million yen. Once you edit any cost field, your values are kept; Reset to defaults restores both parameters and costs. The box below spells out the current rule in words. Signals use the closed bar's close and fill at the next bar's open, always all-in and long only.

  • MA cross: buy when the fast line (EMA 20) crosses above the slow line (EMA 60), sell when it crosses below
  • RSI reversal: buy when RSI(14) crosses back above 30, sell when it falls back below 70
  • Bollinger reversal: buy when the close climbs back above the lower band (20 bars ± 2), sell at or above the middle line (or upper band)
  • MACD cross: buy when MACD(12, 26) crosses above its signal (9), sell when it crosses below
  • Supertrend: buy when the ATR 10, multiplier 3 direction turns up, sell when it turns down
  • Donchian breakout: buy when the close beats the prior 20-bar high, sell when it drops below the prior 10-bar low

Backtest result — nine figures

The title names the symbol, bar size, strategy and parameters, with the time of calculation beside it. Under each figure you also see the buy-and-hold value for the same period, so you can tell at a glance whether the strategy beat simply holding. Buy & hold means buying at the first test bar's open with the same buy costs and holding to the last close. An open position is valued at the last closed bar's close, and unfinished bars (today during the session, this week, this month) are never used, so the figures do not move with intraday prices. With fewer than 10 completed trades, the summary warns that win rate and profit factor are heavily swayed by chance. For dollar and yen stocks the final value also shows a won figure at today's exchange rate.

  • Total return: final equity ÷ starting capital − 1
  • CAGR: omitted under 3 months, flagged under 1 year
  • MDD: the largest fall in equity from its running peak
  • Win rate: share of completed trades that made money, with wins and losses
  • Profit factor: sum of winning trade returns ÷ sum of losing trade losses
  • Trades: completed trades and the yearly average, an open trade counted separately
  • Average trade: mean return per trade with the best and worst
  • Exposure: share of bars spent holding the stock
  • Final equity: what the starting capital became

Price and trades chart

A candlestick chart of closed bars carries the lines the strategy uses (moving averages, Bollinger Bands, Donchian channel, Supertrend), with ▲ on each buy fill and ▼ on each sell fill along with that trade's return. When there are many trades the labels are dropped and only the arrows remain. If the last closed bar produced a new signal, a 'Buy signal' or 'Sell signal' dot appears on it; the fill would be at the next bar's open, so it is not in the trade list yet. For the RSI and MACD strategies a lower pane opens with the RSI line and its levels, or the MACD line, signal and histogram. All charts share the visible range, and Log scale shows long-rising stocks in proportion. Korean stocks have a ±30% daily price limit while US stocks have none, so the next open can land further from the close that triggered the signal.

Where the rule stands now, and trade statistics

'Where the rule stands now' tells you whether following this rule mechanically up to today would leave you holding the stock (In position) or waiting in cash (In cash). If in position, it shows the entry date, fill price and return at the last close; if the last closed bar carries a signal, it says the fill would come at the next trading day's open (next week for weekly bars, next month for monthly). The note beside the title says when it will be recalculated. US daily bars close at 4 p.m. New York time, which is early morning in Korea, so new US signals appear during the Korean morning. The statistics table lists average winning and losing trades, payoff ratio, best and worst trades, longest losing streak, average holding time, how much costs and dividends changed the return, and annual volatility and Sharpe ratio (risk-free rate 0) for both the strategy and buy & hold.

Equity curve, drawdown and yearly returns

The equity curve shows how the starting capital would have grown and shrunk under the strategy, next to buy & hold (dividends reinvested). While the strategy waits in cash, its curve runs flat. The drawdown chart below shows, for both, how far equity sat below its running peak, so you can see which one fell deeper and for longer even when returns are similar. Log scale shows early movements of long periods in proportion. The yearly table compares each year's last closed-bar equity with the previous year's for the strategy and buy & hold, gives the gap in percentage points and the number of trades closed that year, and marks a partial first or last year with its actual dates. Beside the title you see in how many years the strategy beat buy & hold.

Trade list

Each completed trade gets a row, and an open trade is listed separately as in position. Entry and exit dates are exchange dates, and fill prices are the actual (not dividend-adjusted) open plus or minus slippage. Returns subtract commissions and sales tax and reinvest dividends received while holding, so they can differ slightly from a return computed from the two fill prices. Holding time is shown in bar units (trading days, weeks or months). Clicking a trade number moves the price chart to that trade so you can check its markers. For US stocks fills and returns are in dollars; if you invested in won, the exchange-rate change over the same period would alter the result further, which this table does not include.

Three checks against luck

The nearby-parameter check reruns the same period with the two key parameters moved to neighbouring values, up to a 5×5 grid of total returns. Period-type values use ×0.5, 0.75, 1, 1.5 and 2, RSI levels ±5 and ±10, multipliers ±0.5 and ±1, and clicking a cell applies it. If only the centre cell is good and its neighbours are poor, the numbers may have fitted the past by chance. Compare all 6 strategies runs each strategy on its defaults with the same symbol, period and costs, listing CAGR ÷ MDD as well. Same strategy on other stocks applies the current settings to up to 80 symbols in a chosen group (Korean, US or Japanese large caps, ETFs, sector ETFs, indices), loading three at a time, filling rows as results arrive and sorting by any column. The lists are today's large caps, so survivorship bias applies.

How to use it

① Pick the symbol, bar size and period, and look at buy & hold first. ② Choose a strategy, compare total return and MDD with buy & hold, and use the equity curve and yearly table to see when it gained and lost. ③ Check how much costs took, and for Korean stocks rerun on a Korean ETF that tracks the same index. ④ Use the nearby-parameter check, the six-strategy comparison and other stocks to test whether the result is luck. Results change only when a new bar closes, so there is no need to leave it running, but while open it reloads prices every 5 minutes during the session and hourly when the market is closed, updating the result and the current state when the last closed bar changes. A live chart or an indicator signal scanner alongside shows where the rule stands now. Past results do not guarantee future returns.

Things to know

Frequently asked questions

How are dividends handled?

Returns use Yahoo Finance’s adjusted close (dividends and splits), which is the same as reinvesting each dividend received while holding, in full and before tax, on its pay date. Signals and the fill prices shown use the actual price on the chart. “Added by reinvested dividends” in the statistics shows how much dividends changed the result. Dividend tax is not deducted, and indices are price indices with no dividends.

Where do the default tax and fee values come from?

The 0.20% tax on Korean share sales is the 2026 rate (KOSPI: 0.05% securities transaction tax plus 0.15% special rural tax; KOSDAQ: 0.20%). The rate has changed over the years (0.15% in 2025), but one current rate is applied to the whole test. Korean ETFs are exempt from transaction tax on sale, so their default is 0. The 0.015% fee is only a common Korean online rate and varies by broker; overseas symbols assume zero commission. Buying overseas shares through a Korean broker adds trading fees and currency-exchange costs, so enter your own values.

Does the backtest secretly use future data?

No. Signals are computed only up to the close of a finished bar and filled at the next bar’s open. Bars still in progress (today during the session, this week, this month) are not used. On days with a large gap between the previous close and the next open, though, the fill can be far from the price that triggered the signal, and thinly traded stocks may not fill the full size at the open.

How far back does “All available data” go, and what differs in old data?

It starts at the oldest bar Yahoo Finance has. Daily data go back to 1927 for the S&P 500, 1962 for Coca-Cola and 2000 for Samsung Electronics; monthly bars only start around 1985, so use daily or weekly bars for longer histories. The first 300 daily bars (150 weekly, 60 monthly) only warm up the indicators. If the close moves by a factor of more than 8 within one bar, which points to a Yahoo data error, only the bars after it are used and the page says so. Very old bars, such as the S&P 500 before 1962, carry only a close, with open, high and low equal to it, so in that stretch “fill at the next open” is in effect a fill at the next day’s close. Remember too that the same parameters make a much slower moving average on longer bars.

For information only, not investment advice. Prices come from Yahoo Finance via our server and may be delayed 15–20 minutes or more depending on the exchange, or interrupted.

📚 Worth reading
✂️Adjusted Prices and Stock Splits: How Dividends and Splits Change a Chart→ 🧪How to Read Backtest Results: What to Check Before Returns, and Common Pitfalls→ 🧾What leaks when you trade often→ 🕘US Stock Market Hours: Regular, Pre-Market and After-Hours Sessions in Korean Time→
← All stock tools